/**
 * @author Anna-Katharina Wickert 
 * @author Yannic Remmet
 * @author Tobias Trabelsi
 * 
 * @version 
 * @since 27.07.2012
 *
 * @license Beer-Ware License (Revision 42)
 *
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * We wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy us a beer in return.
 * ----------------------------------------------------------------------------
 */
package model;
import java.io.Serializable;

import javax.swing.tree.TreeNode;



public abstract class TreeElement implements Serializable, TreeNode, Comparable<TreeElement> {

	private static final long serialVersionUID = -4066434078224137565L;
	private String title;
	private TreeElement parent;
	TreeElement(String title){
		this(title, null);
	}
	TreeElement(String title, TreeElement parent){
		this.title = title;
		this.parent = parent;
	}
	
	
	public TreeElement getParent() {
		return parent;
	}
	
	public String toString(){
		return title;
	}
	public void setTitle(String s){
		title = s;
	}
	public void setParrent(TreeElement e){
		parent = e;
	}
	public abstract boolean addChild(TreeElement node);
	public abstract TreeElement getChildAt(int childIndex);
	public abstract boolean  hasChildren();
	public abstract int getChildCount();
	public abstract int getIndex(TreeElement node);
	public abstract boolean del(TreeElement node) ;

	@Override
	public boolean getAllowsChildren() {
		return hasChildren();
	}
	@Override
	public boolean isLeaf() {
		return !hasChildren();
	}

} 

	
